#include "Log.hpp"
#include "ThreadPool.hpp"
#include "Task.hpp"

// using namespace LogModule;
using namespace ThreadPoolModule;
int main()
{
    Enable_Console_Sync_Strategy;
    // LOG(DEBUG) << "Hello world," << "gygu";
    // LOG(ERROR) << "Hello world," << "gygu";
    // LOG(FATAL) << "Hello world," << "gygu";
    // LOG(INFO) << "Hello world," << "gygu";

    // Enable_File_Log_Sync_Strategy;
    // LOG(DEBUG) << "Hello world," << "gygu";
    // LOG(ERROR) << "Hello world," << "gygu";
    // LOG(FATAL) << "Hello world," << "gygu";
    // LOG(INFO) << "Hello world," << "gygu";

    //这是没有设计单例模式的使用
    // ThreadPool<task_t> *t = new ThreadPool<task_t>();
    
    // sleep(5);
    // std::unique_ptr<ThreadPool<int>> t = std::make_unique<ThreadPool<int>>();
    // t->Start();
    // sleep(3);
    // t->EnterQueue(download);
    // t->EnterQueue(upload);
    // t->Stop();
    // sleep(5);
    // t->Join();
    
    // delete t;
    // ThreadPool<task_t>::GetInstance();
    // sleep(3);
    
    int count=10;
    while(count--)
    {
        if(count%2==0)ThreadPool<task_t>::GetInstance()->EnterQueue(download);
        else ThreadPool<task_t>::GetInstance()->EnterQueue(upload);
    }
    sleep(3);
    ThreadPool<task_t>::GetInstance()->Stop();
    sleep(5);
    ThreadPool<task_t>::GetInstance()->Join();
    sleep(3);
    return 0;
}